//
//  FocusDoctorModel.m
//  QuickCure
//
//  Created by 凉气的Mac on 16/9/12.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "FocusDoctorModel.h"

#import "NetWorkTool.h"

/** 获取医生列表接口 */
#define kMatchDoctors @"http://iosapi.itcast.cn/matchDoctors.json.php"


@implementation FocusDoctorModel

+(instancetype)focusDoctorModelWithDict:(NSDictionary *)dict{

    FocusDoctorModel *model = [[FocusDoctorModel alloc]init];
    
    [model setValuesForKeysWithDictionary:dict];
    
    return model;
    
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

+(void)focusDoctorModelWithSuccess:(void(^)(NSArray *modelArray))successBlock error:(void(^)())errorBlock{
    
    NSString *urlString = kMatchDoctors;
    NSDictionary *paramDic = @{@"ci1_id":@1,
                               @"ci2_id":@3,
                               @"ci3_id":@3,
                               @"diagnosis_type":@0,
                               @"page_size":@15,
                               @"is_confirmed":@1,
                               @"user_id":@1000089,
                               @"page":@1,
                               @"has_diagnosis":@2
                               };
    
    [[NetWorkTool shareManager] POST_RequestWithUrlString:urlString parmas:paramDic successBloock:^(NSDictionary * responseObject) {
        
        NSArray *array = responseObject[@"data"];
        
        NSMutableArray *muArray = [NSMutableArray array];
        
        [array enumerateObjectsUsingBlock:^(NSDictionary *  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            
            FocusDoctorModel *model = [FocusDoctorModel focusDoctorModelWithDict:obj];
            
            [muArray addObject:model];
            
        }];
        
        if (successBlock) {
            
            successBlock(muArray.copy);
            
        }
        
    } failureBlock:^(NSError *error) {
        
        
        if (errorBlock) {
            
            errorBlock();
            
        }
        
    }];


    
}

@end





























